<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>代码生成系统</title>
    <link href="resources/css/admin_login.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="admin_login_wrap" style="width: 512px;">
    <h1 style="text-align: center;">代码生成系统</h1>
    <div class="adming_login_border">
        <div class="admin_input">
        		<div id="msg" style="color: red;"></div>
               <ul class="admin_items">
                   <li>
                       <label for="user">用户名：</label>
                       <input type="text" name="username" value="admin" id="username" size="40" class="admin_input_style" />
                   </li>
                   <li>
                       <label for="pwd">密码：</label>
                       <input onkeyup="keyPress(event);" type="password" name="pwd" value="admin" id="password" size="40" class="admin_input_style" />
                   </li>
                   <!-- 
                   <li>
                       <label>界面风格：</label>
                       <select id="uiStyle" class="admin_input_style" >
                       		<option value="sys/home.jsp">FDUI</option>
                       		<option value="easyui/page/main.jsp">EasyUI</option>
                       </select>
                   </li>
                    -->
                   <li>
                       <input type="button" tabindex="3" value="登   录" onclick="login();" class="btn btn-primary" />
                   </li>
               </ul>
        </div>
    </div>
</div>

<script type="text/javascript" src="resources/js/libs/jquery.min.js"></script>
<script type="text/javascript" src="resources/js/libs/Action.js"></script>
<script type="text/javascript">
function login(){
	var data = {username:$('#username').val(),password:$('#password').val()};
	Action.post('login.do',data,function(result){
		if (result.success){
			window.location = 'sys/home.jsp';
			//window.location = $('#uiStyle').val();
		} else {
			var errorMsg = result.message;
			$('#msg').html(errorMsg);
		}
	});
}

function keyPress(event){
	if(event.keyCode == 13){
		login();
	}
}

$(function(){
	$('#username').focus();
})
</script>
</body>
</html>